﻿<%@ Page Title="" Language="C#" MasterPageFile="main.Master" AutoEventWireup="true" CodeBehind="parental.aspx.cs" Inherits="comix.admininstration.parental" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h2>Καταλληλότητες</h2>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="par_id" 
        DataSourceID="SqlDataSource1" InsertItemPosition="LastItem" >
        <ItemTemplate>
            <tr style="">
                <td>
                    <asp:Label ID="pub_nameLabel" runat="server" Text='<%# Eval("par_description") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="DeleteButton" runat="server" CommandName="Delete" 
                        Text="Διαγραφή" />
                    <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit" Text="Επεξεργασία" />
                </td>                
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr style="">
                <td>
                    <asp:Label ID="pub_nameLabel" runat="server" Text='<%# Eval("par_description") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="DeleteButton" runat="server" CommandName="Delete" 
                        Text="Διαγραφή" />
                    <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit" Text="Επεξεργασία" />
                </td>                
            </tr>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <table id="Table1" runat="server" style="">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <tr style="">
                <td>
                    <asp:TextBox ID="pub_nameTextBox" runat="server" 
                        Text='<%# Bind("par_description") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Εισαγωγή" />
                </td>                
            </tr>
        </InsertItemTemplate>
        <LayoutTemplate>
            <table id="Table2" runat="server">
                <tr id="Tr1" runat="server">
                    <td id="Td1" runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="0" style="">
                            <tr id="Tr2" runat="server" style="">
                                <th id="Th1" runat="server">
                                    Όνομα</th>
                                <th id="Th2" runat="server">
                                </th>                                                                        
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr id="Tr3" runat="server">
                    <td id="Td2" runat="server" style="">
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" FirstPageText="<<"
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" LastPageText=">>"
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <EditItemTemplate>
            <tr style="">
                <td>
                    <asp:TextBox ID="pub_nameTextBox" runat="server" 
                        Text='<%# Bind("par_description") %>' />
                    <asp:Label ID="Label1" Visible="false" runat="server" Text='<%# Eval("par_id") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Αποθήκευση" />
                    <asp:LinkButton ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Άκυρο" />
                </td>                
            </tr>
        </EditItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:mainconectionstring %>" 
        DeleteCommand="UPDATE PARENTAL set par_deleted = 1, par_updatedate = getDate() WHERE par_id = @par_id" 
        InsertCommand="INSERT PARENTAL (par_description,par_updatedate,par_deleted) VALUES (@par_description, getDate(),0)" 
        SelectCommand="SELECT par_id, par_description FROM PARENTAL WHERE par_deleted = 0 ORDER BY par_description" 
        UpdateCommand="UPDATE PARENTAL SET par_description = @par_description, par_updatedate=getDate() WHERE par_id = @par_id">
        <DeleteParameters>
            <asp:Parameter Name="par_id" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="par_description" />
            <asp:Parameter Name="par_id" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="par_description" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>
